package com.haitonghop.utils;

import android.content.Context;

import com.facebook.android.SessionStore;
import com.haitonghop.R;

public class AppSettingParams {

	public static boolean isUseBigImage() {
		return (SCREEN_WIDTH > 320);
	}

	public static int VERSION_CODE = 20;

	public static String pr_publish_id = "";
	public static String faceBook_appId = "";
	public static boolean isInitAds = false;
	public static boolean useGoogleAds = false;
	public static String userDisplayName = "";
	public static String userAvatar = "";
	public static boolean isDontAskIfNotLoginFB = false;

	public static boolean isRevertChapter = false;

	public static void setReverChapter(Context context, boolean enable) {
		isRevertChapter = enable;
		SessionStore.saveRevertChapter(context, enable);
	}

	public static void setIsDontAskIfNotLoginFB(Context context, boolean enable) {
		isDontAskIfNotLoginFB = enable;
		SessionStore.saveDontAskIfNotLoginFb(context, isDontAskIfNotLoginFB);
	}

	public static void save(Context context) {
		SessionStore.saveInfoFaceBook(context, userDisplayName, userAvatar);
	}

	public static boolean isUseGoogleAds() {
		return isInitAds && useGoogleAds;
	}

	public static void initSession(Context context) {
		isDontAskIfNotLoginFB = SessionStore.loadDontAskIfNotLoginFb(context);
		String[] info = SessionStore.loadInfoFaceBook(context);
		if (info != null && info.length > 1) {
			userDisplayName = info[0];
			userAvatar = info[1];
		}
	}

	public static void initPublishId(Context context) {
		if (context != null) {
			pr_publish_id = context.getResources().getString(R.string.ads_pub_id);
		}
		Logger.logMe("pr_publish_id = " + pr_publish_id);

		isRevertChapter = SessionStore.loadRevertChapter(context);
	}

	public static void initFaceBookAppId(Context context) {
		if (context != null) {
			faceBook_appId = context.getResources().getString(R.string.app_id);
		}
		Logger.logMe("faceBook_appId = " + faceBook_appId);
	}

	public static long SCREEN_WIDTH = 0;
	public static long SCREEN_HEIGHT = 0;

	private static long requestId = 0;

	public static final long nextRequestId() {
		return ++requestId;
	}

	final public static int COUNT = 50;
}
